<template>
	<view class="inform">
		<headertop title="抽奖记录" str1="oridei" :back1="back1"></headertop>
		<image src="https://huarun123.oss-cn-shenzhen.aliyuncs.com/static/Rectangle 21541@2x.png" class="inform_back"
			mode=""></image>
		<view class="contents">
			<view class="contents_item" v-for="item in list" :key="item.id" @click="popuopen(item)">
				<image src="https://huarun123.oss-cn-shenzhen.aliyuncs.com/static/Group 11522@2x.png" mode=""></image>
				<view class="texts">
					<view class="texts_t1">
						{{item.gettitle}}
					</view>
					<view class="texts_t2">
						{{timestampfun(item.createtime*1000)}}
					</view>
				</view>
			</view>
			<view class="msgicon" v-if="!list.length">
				<image src="/static/微信图片_20250508155422.png" mode="widthFix"></image>
				<view class="msgtext">
					暂无抽奖记录
				</view>
			</view>

		</view>
		<uni-popup ref="popup" type="center">
			<view class="chongzhongjp">
				<image src="https://huarun123.oss-cn-shenzhen.aliyuncs.com/static/微信图片_20250506175631.png"
					class="chongzhongjp_back" mode="widthFix">
				</image>
				<image src="https://huarun123.oss-cn-shenzhen.aliyuncs.com/static/Frame@2x(10).png" class="closeicon"
					@click="close" mode="">
				</image>
				<view class="gongxinitext">
					恭喜您抽中{{contentobj.gettitle}}
				</view>
				<image src="https://huarun123.oss-cn-shenzhen.aliyuncs.com/static/Group 11468@2x.png" class="contentimg"
					mode=""></image>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import {
		jiangpin
	} from '@/common/api/api.js'
	import headertop from '@/components/header.vue'
	export default {
		components: {
			headertop
		},
		data() {
			return {
				back1: 0,
				totle: 0,
				list: [],
				contentobj: {}
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			timestampfun(time) {
				const date = new Date(time);
				const year = date.getFullYear();
				const month = String(date.getMonth() + 1).padStart(2, "0");
				const day = String(date.getDate()).padStart(2, "0");
				const hours = String(date.getHours()).padStart(2, "0");
				const minutes = String(date.getMinutes()).padStart(2, "0");
				const seconds = String(date.getSeconds()).padStart(2, "0");
				const formattedDate = `${year}-${month}-${day}`;
				return formattedDate
			},
			close() {
				this.$refs.popup.close('center')
			},
			async init() {
				const res = await jiangpin()
				if (res.code == 1) {
					this.list = res.data.list
					this.totle = res.data.count
				}
			},
			popuopen(item) {
				this.contentobj = item
				this.$refs.popup.open('center')
			}
		},
		onPageScroll(e) {
			console.log(e, 'eeeeeeeeeeeeeee');
			if (e.scrollTop > 100) {
				this.back1 = '#A2AEFF'
			} else {
				this.back1 = ''
			}
		}
	}
</script>

<style lang="scss">
	.msgicon {
		width: 300rpx;
		margin: 100rpx auto;
		overflow: hidden;

		.msgtext {
			font-size: 45rpx;
			font-weight: bold;
			text-align: center;
			width: 100%;
		}

		image {
			width: 300rpx;
		}
	}

	page {
		background: #F7F8FA;
	}

	.chongzhongjp {
		width: 650rpx;
		// height: 554rpx;
		border-radius: 28rpx 28rpx 28rpx 28rpx;
		position: relative;
		overflow: hidden;

		&_back {
			width: 650rpx;
			height: 554rpx;
			position: absolute;
			z-index: -1;
		}

		.closeicon {
			position: absolute;
			width: 36rpx;
			height: 36rpx;
			right: 28rpx;
			top: 28rpx;
		}

		.gongxinitext {
			width: 370rpx;
			margin: auto;
			font-size: 36rpx;
			color: #FE34B9;
			font-weight: bold;
			margin-top: 88rpx;
			text-align: center;
		}

		.contentimg {
			width: 540rpx;
			height: 340rpx;
			margin: 30rpx auto;
			display: block;
		}
	}

	.inform {
		width: 100%;
		overflow: hidden;
		position: relative;

		&_back {
			width: 100%;
			height: 314rpx;
			position: absolute;
			z-index: -1;
		}

		.contents {
			width: 686rpx;
			margin: auto;
			margin-top: 196rpx;
			overflow: hidden;

			&_item {
				width: 100%;
				height: 144rpx;
				background: #FFFFFF;
				box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(0, 0, 0, 0.15);
				border-radius: 16rpx 16rpx 16rpx 16rpx;
				display: flex;
				align-items: center;
				margin-bottom: 24rpx;

				image {
					width: 96rpx;
					height: 96rpx;
					margin-left: 24rpx;
				}

				.texts {
					margin-left: 20rpx;

					&_t1 {
						font-family: PingFang SC, PingFang SC;
						font-weight: bold;
						font-size: 32rpx;
						color: #1D2129;
					}

					&_t2 {
						font-family: PingFang SC, PingFang SC;
						font-weight: 400;
						font-size: 28rpx;
						color: #86909C;
						margin-top: 24rpx;
					}
				}
			}
		}




	}
</style>